import request from '@/utils/request'
var qs = require('qs')
const URL = {
  getShoppingMallInfo: 'getGoods', // 获取首页基础数据'
  registerUser: 'user/register', // 用户注册接口
  login: 'user/login', // 用登录接口
  getCategoryList: 'goods/getCategoryList', // 获取大类列表信息
  getCategorySubList: 'goods/getCategorySubList', // 获取小类列表信息
  getGoodsList: 'goods/getGoodsListByCategorySub', // 根据类别获取商品列表
  GoodsDetail: 'goods/getDetailGoodsInfo'// 商品详情接口
}
export function getShoppingMallInfo () {
  return request({
    url: URL.getShoppingMallInfo,
    method: 'get'
  })
}
export function register (params) {
  return request({
    url: URL.registerUser,
    method: 'post',
    data: qs.stringify(params)
  })
}
export function login (params) {
  return request({
    url: URL.login,
    method: 'post',
    data: qs.stringify(params)
  })
}
export function name (params) {
  return request({
    url: URL.GoodsDetail,
    method: 'post',
    data: qs.stringify(params)
  })
}
export function getCategoryList () {
  return request({
    url: URL.getCategoryList,
    method: 'get'
  })
}
export function getCategorySubList (params) {
  return request({
    url: URL.getCategorySubList,
    method: 'post',
    data: qs.stringify(params)
  })
}
export function getGoodsList (params) {
  return request({
    url: URL.getGoodsList,
    method: 'post',
    data: qs.stringify(params)
  })
}
// const BASEURL = 'https://www.easy-mock.com/mock/5b5fc216ce93cc61fbbab382/smileVue/'
// const URL = {
//   getShoppingMallInfo: BASEURL + 'getGoods', // 获取首页数据
//   getGoodsIfno: BASEURL + 'getGoodsInfo'
// }
// module.exports = URL
